package com.longxi.tianjintianbao.ui.activity.energy_read;

import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.longxi.tianjintianbao.R;
import com.longxi.tianjintianbao.ui.base.BaseActivity;
import com.longxi.tianjintianbao.ui.presenter.energy_read.EnergyReadListAtPresenter;
import com.longxi.tianjintianbao.ui.view.energy_read.IEnergyReadListAtView;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener;

import butterknife.BindView;

public class EnergyReadListActivity extends BaseActivity<IEnergyReadListAtView, EnergyReadListAtPresenter> implements IEnergyReadListAtView {

    private final String TAG = "EnergyReadListActivity";
    @BindView(R.id.tvSelectBuild)
    TextView mTvSelectBuild;
    @BindView(R.id.houseWaterMeter)
    LinearLayout mHouseWaterMeter;
    @BindView(R.id.houseElectricMeter)
    LinearLayout mHouseElectricMeter;
    @BindView(R.id.publicWaterMeter)
    LinearLayout mPublicWaterMeter;
    @BindView(R.id.publicElectricMeter)
    LinearLayout mPublicElectricMeter;

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_energy_read_list;
    }

    @Override
    public void initData() {
        super.initData();
        mPresenter.setBar();
    }

    @Override
    public void initListener() {
        super.initListener();
        mTvSelectBuild.setOnClickListener(v -> mPresenter.changeBuild("", ""));
        mHouseWaterMeter.setOnClickListener(v -> mPresenter.toMetersList("1","1"));
        mHouseElectricMeter.setOnClickListener(v -> mPresenter.toMetersList("1","2"));
        mPublicWaterMeter.setOnClickListener(v -> mPresenter.toMetersList("2","1"));
        mPublicElectricMeter.setOnClickListener(v -> mPresenter.toMetersList("2","2"));
    }

    @Override
    protected EnergyReadListAtPresenter createPresenter() {
        return new EnergyReadListAtPresenter(this);
    }

    public void refreshReceiptList() {
        mRefreshLayout.autoRefresh();
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if(RESULT_OK != resultCode){
            return;
        }
    }

    @Override
    public TextView getTvSelectBuild() {
        return mTvSelectBuild;
    }

    @Override
    public LinearLayout getHouseWaterMeter() {
        return mHouseWaterMeter;
    }

    @Override
    public LinearLayout getHouseElectricMeter() {
        return mHouseElectricMeter;
    }

    @Override
    public LinearLayout getPublicWaterMeter() {
        return mPublicWaterMeter;
    }

    @Override
    public LinearLayout getPublicElectricMeter() {
        return mPublicElectricMeter;
    }
}
